import request from '../../utils/request'

export function requestCategoryList () {
    return new Promise((resolve) => {
        request.get('/category/getAll').then(res => {
            resolve(res.data)
        })
    })
}

export function requestAddCategoryList (category) {
    return new Promise(resolve => {
        request.post('/category/add', {
            category,
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestEditCategorylist (category, newval) {
    return new Promise(resolve => {
        request.post('/category/edit', {
            category,
            newval
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestRemoveCategoryList (category) {
    return new Promise(resolve => {
        request.post('/category/remove', {
            category
        }).then(res => {
            resolve(res.data)
        })
    })
}
